//
//  ZWEmoticonKeyBoard.swift
//  ZWWeibo
//
//  Created by flyiron on 16/4/28.
//  Copyright © 2016年 flyiron. All rights reserved.
//

import UIKit


class ZWEmoticonKeyBoard: UIView {
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI(){
        backgroundColor = UIColor(patternImage: UIImage(named: "emoticon_keyboard_background")!)
        addSubview(toolbar)
        
        
        toolbar.snp_makeConstraints { (make) in
            make.leading.bottom.trailing.equalTo(self)
        }
    }
    
    //// MARK: - 懒加载控件
    private lazy var toolbar:ZWKeyboardToolbar = {
        let bar = ZWKeyboardToolbar(frame: CGRectZero)
        bar.keyboardClosure = {(type:ZWKeyboardToolbarType) in
            print(type)
        }
        return bar
    }()
    
    private lazy var emoticonCollectionView:UICollectionView = {
        let view = UICollectionView(frame: CGRectZero, collectionViewLayout: UICollectionViewFlowLayout())
        view.registerClass(UICollectionViewCell.self, forCellWithReuseIdentifier: "cell")
        view.delegate = self
        view.dataSource = self
        
        return view
    }()
}

extension ZWEmoticonKeyBoard:UICollectionViewDataSource,UICollectionViewDelegate{
    func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
        return 3
    }
    func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return 3
        
    }
    
    func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCellWithReuseIdentifier("cell", forIndexPath: indexPath)
        return cell
    }
}
